var vm =new Vue({
    el:'#topic',
    data:{
        newsEntiys: null,
        topicId: 1
    },
    methods:{
        //获取id值
        setTopicId : function (tid) {
            this.topicId = tid;
        },
        hrefData:function (data) {
            return "/newspage?nid="+data;
        }
    },
    mounted(){
        axios
            .get('/news', {
                params: {
                    tid : this.topicId
                }
            })
            .then(response => (
                this.newsEntiys = response.data
                )
            )
            .catch(function (error) { // 请求失败处理
                console.log(error);
            });
    }
})

var vm1 = new Vue({
    el:'#news',
    data:{

    },
    methods: {
        setNewsEntiys : function (id) {
            axios
                .get('/news', {
                    params: {
                        tid : id
                    }
                })
                .then(response => (
                        vm.newsEntiys = response.data
                    )
                )
                .catch(function (error) { // 请求失败处理
                    console.log(error);
                });
        }
    }

})
